package com.itlaoqi.cf.service;

import com.itlaoqi.cf.dto.Product;

import java.util.ArrayList;
import java.util.List;

public class ProductService {

    private List<Product> products = new ArrayList<>();

    public ProductService() {
        products.add(new Product("1", "Laptop", "High performance laptop for professionals", 1200.00));
        products.add(new Product("2", "Smartphone", "Latest smartphone with advanced features", 800.00));
        products.add(new Product("3", "Headphones", "Wireless headphones with noise cancellation", 250.00));
    }


    public List<Product> search() {
        System.out.println("execute ProductService.search()");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        return products;
    }
}
